package com.huawei.appgallery.packagemanager.impl.install.control;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.huawei.secure.android.common.intent.SafeIntent;
import o.cnu;
import o.coo;
import o.cop;
import o.cpp;
import o.cpq;

public class InstallResultReceiver extends BroadcastReceiver {
    public void onReceive(Context context, Intent intent) {
        SafeIntent safeIntent = new SafeIntent(intent);
        int intExtra = safeIntent.getIntExtra("android.content.pm.extra.STATUS", 1);
        String stringExtra = safeIntent.getStringExtra("android.content.pm.extra.STATUS_MESSAGE");
        if (stringExtra == null) {
            stringExtra = "";
        }
        String stringExtra2 = safeIntent.getStringExtra("package_task_result_receiver_packagename");
        if (TextUtils.isEmpty(stringExtra2)) {
            cnu.ˏ.ˊ("InstallResultReceiver", "Error Pkg");
            return;
        }
        int ˋ;
        String stringExtra3 = safeIntent.getStringExtra("android.content.pm.extra.OTHER_PACKAGE_NAME");
        String stringExtra4 = safeIntent.getStringExtra("android.content.pm.extra.STORAGE_PATH");
        long longExtra = safeIntent.getLongExtra("package_task_result_receiver_taskid", 0);
        if (intExtra != 0) {
            ˋ = cpq.ˋ(stringExtra);
        } else {
            ˋ = 1;
        }
        cnu.ˏ.ˋ("InstallResultReceiver", " package install callback:packageName:[" + stringExtra2 + "],statusCode:[" + intExtra + "],extraStatus:[" + stringExtra + "],otherPkgName:[" + stringExtra3 + "],storagePath:[" + stringExtra4 + "],resultCode:[" + ˋ + "]");
        if (1 == ˋ && cop.ˊ != null) {
            cop.ˊ.ˊ(stringExtra2);
        }
        new coo().ˋ(context, stringExtra2);
        cpp.ˏ(context, stringExtra2, ˋ, longExtra, 3, false);
    }
}
